/**
 * Copyright 2008-2009 HAN.BIFANG
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 *
 */
package han.bifang.gwt.client.domain.content;

import han.bifang.gwt.client.common.Content;
import han.bifang.gwt.client.common.ContentChangeListener;
import han.bifang.gwt.client.common.GwtContext;
import han.bifang.gwt.client.communicate.BifangGWTServiceAsync;
import han.bifang.gwt.client.domain.DomainMessages;

import com.google.gwt.user.client.ui.TabPanel;

/**
 * 
 * @Author Kent
 */
public class CatalogDetailContent extends Content{
	private DomainMessages cons;
	private BifangGWTServiceAsync service;
	private String catalogId = null;
	private CatalogDetailSubContent s;
	private CatalogMonitorContent cmc;
	private GwtContext context;
	
	
	public void setContentChangeListener(ContentChangeListener l){
		s.setContentChangeListener(l);
		cmc.setContentChangeListener(l);
	}
	
	public CatalogDetailContent(DomainMessages cons,BifangGWTServiceAsync service,String catId,GwtContext context){
		this.cons = cons;
		this.service = service;
		this.catalogId = catId;
		this.context = context;
		
		TabPanel panel = new TabPanel();
		panel.setWidth("100%");
		s = new CatalogDetailSubContent(cons,service,catalogId,context);
		s.setContentChangeListener(this.listener);
		panel.add(s,cons.overview());
		
		cmc = new CatalogMonitorContent(cons,service,catalogId,context);
		cmc.setContentChangeListener(this.listener);
		panel.add(cmc,cons.monitor());
		
		panel.selectTab(0);
		
		initWidget(panel);
		
		
		
	}
	
}
